package com.itheima.servlet;

import com.itheima.factory.BeanFactory;
import com.itheima.service.UserService;
import com.itheima.service.impl.UserServiceImpl;


/**
 * 模拟表现层，用于调用业务层
 */
public class Client {

    public static void main(String[] args) {
//        UserService userService = new UserServiceImpl();
        /**
         * 控制反转：控制发生的反转，交给工厂去决定，之前是自己决定的
         */

        UserService userService1 = (UserService) BeanFactory.getBean("userService");
        UserService userService2 = (UserService) BeanFactory.getBean("userService");
        UserService userService3 = (UserService) BeanFactory.getBean("userService");
        UserService userService4 = (UserService) BeanFactory.getBean("userService");
//        userService.saveUser();
        System.out.println(userService1);
        System.out.println(userService2);
        System.out.println(userService3);
        System.out.println(userService4);
    }
}
